#ifndef _pt_MONITOR_H
#define _pt_MONITOR_H

#define PT_MONITOR_TIMER_PERIOD	4

/*	for status	*/
typedef enum pt_status
{
	PT_STATUS_SUCCESS	= 0,
	PT_STATUS_FAILED,
	PT_STATUS_NO_MEMORY,
	PT_STATUS_NULL_POINTER,
	PT_STATUS_INVALID_PARAM,

	PT_STATUS_MAX
} pt_status_t;

#define PT_ARRAY_SIZE(array)	(sizeof(array) / sizeof(array[0]))

typedef rt_uint16_t pt_msg_id_t;
typedef rt_uint8_t pt_task_id_t;
typedef rt_uint32_t pt_wparam_t;
typedef rt_uint32_t pt_lparam_t;
typedef rt_uint32_t pt_wparam_t;
typedef rt_uint32_t pt_time_t;

typedef struct pt_message
{
	/* the event type */
	pt_msg_id_t message;

	/* user field of event */
	pt_task_id_t	srcId;

	/* the event sender */
	pt_task_id_t	destId;

	pt_wparam_t wparam;		
	pt_lparam_t lparam;
} 	pt_message_t;

void pt_msgqueue_system_init();

extern pt_status_t pt_post_message(pt_task_id_t dest_task_id, pt_msg_id_t msg_id, 
							pt_wparam_t wparam, pt_lparam_t lparam);
extern pt_status_t pt_post_time_message(pt_task_id_t dest_task_id, pt_msg_id_t msg_id, 
							pt_wparam_t wparam, pt_lparam_t lparam, pt_time_t time);
extern pt_status_t pt_send_message(pt_task_id_t dest_task_id, pt_msg_id_t msg_id, 
							pt_wparam_t wparam, pt_lparam_t lparam);

extern pt_status_t pt_peek_message(pt_message_t* message);
extern pt_status_t pt_translate_message(pt_message_t* message);
extern pt_status_t pt_dispatch_message(pt_message_t* message);
extern pt_status_t pt_delete_message_quick(pt_msg_id_t msg_id);
extern pt_status_t pt_delete_message(pt_message_t* message);

extern void pt_exec_time_task(void);

typedef	void (* pt_task_handler_t)(pt_message_t *message);

enum {
	PT_TSK_ID_PAGE_CTRL,

	PT_TSK_ID_MAX
};
#endif